import { defineMongooseModel } from '#nuxt/mongoose'

export const Topic = defineMongooseModel({
  name: 'Topic',
  schema: {
    topic: {
      type: String,
      required: true,
      trim: true
    },
    answer: {
      type: String,
      required: true,
      trim: true
    },
    type: {
      type: String,
      required: true,
      trim: true
    },
    area: {
      type: String,
      required: true,
      trim: true
    },
    difficulty: {
      type: String,
      required: true,
      trim: true,
      enum: ['简单', '中等', '困难']
    }
  },
  options: {
    timestamps: true // 自动添加 createdAt 和 updatedAt 字段
  }
})